<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="/static/cart/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="/static/cart/bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript" src="/static/cart/js/swiper.min.js"></script>
	<script src="/static/cart/js/swiper.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/cart/css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/cart/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/static/cart/css/success.css" />

 </head>

    <body>
    <!--头部-->
    <div class="alert-info">
        <div class="hd_wrap_top">
        <ul class="hd_wrap_left">
        <li class="hd_home"><i class="glyphicon glyphicon-home"></i>
        <a href="http://gulimall.com">谷粒商城首页</a>
        </li>

        </ul>

        <ul class="hd_wrap_right">
        <li class="forel">
        <a href="http://auth.gulimall.com/login.html" class="link_login">你好,请登录</a>&nbsp;
    <a href="http://auth.gulimall.com/reg.html" class="link_regist">免费注册</a>
        </li>
        <li class="spacer"></li>

        <li>
        <a href="http://member.gulimall.com/memberOrder.html">我的订单</a>
        </li>



        </ul>

        </div>
      </div>

        <div class="nav-tabs-justified">
        <div class="nav_wrap">

        <div class="nav_top">
        <div class="nav_top_one">
        <a href="http://gulimall.com"><img src="/static/cart/img/logo1.jpg"  style="height: 60px;width:180px;"  /></a>
        </div>
        <div class="nav_top_two"><input type="text" /><button>搜索</button></div>





    </div>

    </div>
    </div>

    <div class="main">

        <div class="success-wrap">
            <div class="w" id="result">
                <div class="m succeed-box">
                    <div class="mc success-cont" th:if="${orderSn!=null}">
                        <div class="success-lcol">
                            <div class="success-top"><b class="succ-icon"></b>
                                <h3 class="ftx-02">恭喜，秒杀成功！订单号：[[${orderSn}]]</h3></div>
                            <h3 class="ftx-02" style="color:red;">正在准备订单数据，10s以后自动跳转支付
                                <a id="pay" th:attr="ordersn=${orderSn}" onclick="toPay()">去支付</a>
                            </h3>
                        </div>
                    </div>
                    <div th:if="${orderSn==null}">
                        <h1>手气不好，秒杀失败！</h1>
                    </div>
                </div>
                </div>
            </div>
        </div>

    </div>
    <script>
            //10s后支付
            setTimeout(() => {
                //判断是否秒杀成功
                let orderSn = $("#pay").attr("ordersn");
                console.log(orderSn);
                if (!orderSn) {
                    //正确判断空值教程 https://baijiahao.baidu.com/s?id=1739474198778045889&wfr=spider&for=pc
                    return false;
                }else {
                    location.href = "http://order.gulimall.com/payOrder?orderSn=" + orderSn;
                }
            }, 10000)

        //跳转支付页面
        function toPay(){
            let orderSn = $("#pay").attr("ordersn");
            if (orderSn!='' || orderSn.length!=0) {
                //console.log(orderSn)
                location.href = "http://order.gulimall.com/payOrder?orderSn=" + orderSn;
            }
            return false;
        }


    </script>
    </body>
    <script type="text/javascript" src="/static/cart/js/success.js"></script>

</html>
